﻿

<%--
 *  File:   HospitalBuySaleStockByTime.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		  Changes
 *  2011-7-5	  JackYin		  Created
 *
 *  Copyright (C) 2000 - 2011 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "A0121";
  String strTableName = "v_zylhospitalbuysalesstockbytime";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/rpt/ReportURL.inc" %>

<html>
<head>
<title>HospitalBuySaleStockByTime.jsp</title>
<PageFlow:CheckPageFlow pageName="p_zylhospitalbuysalesstockbytime" />
<%
Vector summary = (Vector)pageContext.getAttribute("totalsummary");

HashMap userinfo = (HashMap)session.getAttribute("userinfo");  
Integer  issalesman = (Integer) userinfo.get("issalesman");
String  isadmin=(String)userinfo.get("isadmin");
if(isadmin==null) isadmin="";
String flag = (String)request.getParameter("flag");
String ruleday = (String)pageContext.getAttribute("ruleday");
String runstatus = (String)pageContext.getAttribute("runstatus");
java.util.Calendar cal = java.util.Calendar.getInstance();  
if(summary == null)summary = new Vector();
%>
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>


<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  <%if(!runstatus.equals("END")){ %>
   alert("<%= message.getMessageDesc("Being_Aggregate_Please_Try_Again_Later")%>");
   return;
  <%} %>
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  var startyear = document.cform.startyears.value;
  var startmonth = document.cform.startmonths.value;
  var endyear = document.cform.endyears.value;
  var endmonth = document.cform.endmonths.value;
  if(Number(startyear) > Number(endyear)){
	  alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	  return;
  }
  else {
	  if(Number(startyear) == Number(endyear)){
	  if(Number(startmonth) > Number(endmonth)){
	      alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	     return;
	   }
  	 }
  }
  if(getflag()){
	  var year =document.cform.year.value;
	  var month =document.cform.month.value;
      if(month == 1){
    	 document.cform.oldendyear.value = year -1;
    	 document.cform.oldendmonth.value= 12;
      }else{
    	 document.cform.oldendyear.value = year;
     	 document.cform.oldendmonth.value= month-1;
      } 
  }
  editform.action = "HospitalBuySaleStockByTime.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function subDiv() {
	//alert();
   // var req = new Request({
   //     url: '../../Dispatcher',
    //    onSuccess: function(txt) {
   //         hidDiv("submit");
   //     }
   // }); 
   // alert();
   // var remark = document.getElementsByName("remark")[0].value;
   // alert(remark);
   // var purchasemonthdataid = document.getElementsByName("purchasemonthdataid")[0].value;
   // alert(purchasemonthdataid);
   // req.send('actionname=save&pagename=p_purchaseverify&purchasemonthdataid' + purchasemonthdataid + '&remark'+remark);
   	document.cform.actionname.value = "saveh";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}

function showDiv(element) {
    var W = document.documentElement.scrollWidth;
    var H = document.documentElement.scrollHeight;
    var selfW = document.getElementById(element).style.width;
    var selfH = document.getElementById(element).style.height;
    document.getElementById(element).style.left = (W - parseInt(selfW)) / 2 + 'px';
    document.getElementById(element).style.top = (H - parseInt(selfH)) / 2 + 'px';
    document.getElementById(element).style.display = 'block';
    var mDiv = document.getElementById("mDiv");
    mDiv.style.display = '';
    document.cform.subbutton.focus();
    
}

function hidDiv(element) {
    document.getElementById(element).style.display = 'none';
    document.getElementById("mDiv").style.display = 'none';
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.orgposdata_id.value = eval('obj.all.orgposdataid'+idx).value;
  cform.re_mark.value = eval('obj.all.remarks'+idx).value;
  cform.temporgid.value = eval('obj.all.orgid'+idx).value;
  cform.tempproductid.value = eval('obj.all.productid'+idx).value;
  cform.tempyear.value = eval('obj.all.year'+idx).value;
  cform.tempmonth.value = eval('obj.all.month'+idx).value;
  
  
}



function page_pass(){
  if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  for(var i=0;i<cform.deleteids.length;i++){
		var n = i + 1;
		if(cform.deleteids[i].checked){
			if(eval('cform.folwqty'+n).value == "" || eval('cform.notfolwqty'+n).value == "" || eval('cform.qty'+n).value == "")
				{
				alert('<%=message.getMessageDesc("Verify_Pass")%>');
				return;
				}
		}
	  }
  if(!confirm("<%=message.getMessageDesc("ZYL_TDR_YESPASS")%>"))return;
  cform.changestatus.value = 41;
  cform.actionname.value = "approve";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_noPass(){
	if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
	 for(var i=0;i<cform.deleteids.length;i++){
			var n = i + 1;
			if(cform.deleteids[i].checked){
				if(eval('cform.folwqty'+n).value == "" || eval('cform.notfolwqty'+n).value == "" || eval('cform.qty'+n).value == ""){alert('<%=message.getMessageDesc("Verify_Pass")%>');return;}
			}
		  }
  if(!confirm("<%=message.getMessageDesc("ZYL_TDR_NOTPASS")%>"))return;
  cform.changestatus.value = 28;
  cform.actionname.value = "approve";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_reTypeIn(){
	if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
	 for(var i=0;i<cform.deleteids.length;i++){
			var n = i + 1;
			if(cform.deleteids[i].checked){
				if(eval('cform.status'+n).value != "28"){alert('<%=label.getLabelName("L_PleseNoPass") %>');return;}
			}
		  }
  cform.actionname.value = "retypeinh";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_InBuyDetail()
{
	var year =document.cform.tempyear.value;
	var month =document.cform.tempmonth.value;
   
	var productid = document.cform.tempproductid.value;
	var orgid = document.cform.temporgid.value;
	
	<%if(!(new Integer(1).equals(issalesman))){%>
    userids = cform.userids.value;
    var areaids = cform.areaids.value;
	popup('HospitalInBuyDetail.jsp?<%= OvalTools.randomURL() %>&partnerid='+orgid+'&productid='+productid+'&year='+year+'&month='+month +'&userids='+userids +'&globalpccode=113&areaids='+areaids,'newwindow','height=400, width=1200,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
    <%}else{%>
	popup('HospitalInBuyDetail.jsp?<%= OvalTools.randomURL() %>&partnerid='+orgid+'&productid='+productid+'&year='+year+'&month='+month +'&globalpccode=113','newwindow','height=500, width=1200,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}%>
}


function page_StockDetail()
{
	var year =document.cform.tempyear.value;
	var month =document.cform.tempmonth.value;
	var productid = document.cform.tempproductid.value;
	var orgid= document.cform.temporgid.value;
	<%if(!(new Integer(1).equals(issalesman))){%>
	    //regionid = cform.regionid.value;
	    userids = cform.userids.value;
		//proviceofficecode = document.cform.proviceofficelist.value;
		//businessareacode = document.cform.businessarealist.value;
	popup('HospitalStockDetail.jsp?<%= OvalTools.randomURL() %>&orgid='+orgid+'&productid='+productid+'&year='+year+'&month='+month,'newwindow','height=400, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}else{%>
	popup('HospitalStockDetail.jsp?<%= OvalTools.randomURL() %>&orgid='+orgid+'&productid='+productid+'&year='+year+'&month='+month,'newwindow','height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}%>
}

function page_OutBuyDetail()
{
	var year =document.cform.tempyear.value;
	var month =document.cform.tempmonth.value;
    
	var productid = document.cform.tempproductid.value;
	var orgid = document.cform.temporgid.value;
	<%if(!(new Integer(1).equals(issalesman))){%>
	    //regionid = cform.regionid.value;
	    var userids = cform.userids.value;
	    var areaids = document.cform.areaids.value;
		//proviceofficecode = document.cform.proviceofficelist.value;
		//businessareacode = document.cform.businessarealist.value;
	popup('HospitalOutBuyDetail.jsp?<%= OvalTools.randomURL() %>&partnerid='+orgid+'&productid='+productid+'&year='+year+'&month='+month +'&userids='+userids+ +'&globalpccode=113&areaids='+areaids,'newwindow','height=400, width=1200,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}else{%>
	popup('HospitalOutBuyDetail.jsp?<%= OvalTools.randomURL() %>&partnerid='+orgid+'&productid='+productid+'&year='+year+'&month='+month+'&globalpccode=113','newwindow','height=500, width=1200,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}%>
}


//salesman
function popRep() {
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>";
  
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getsecond 
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_zylhospitalbuysalesstockbytime");
	datahandler.runDataHandler();
  }



function page_getbusinessarea(){
	var objdeptcode=eval("cform.proviceofficelist");
	var regionid = document.cform.regionid.value;
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , regionid , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_zylhospitalbuysalesstockbytime");
	datahandler.runDataHandler();
 }


function page_excel(){
	<%if(!runstatus.equals("END")){ %>
	   alert("<%= message.getMessageDesc("Being_Aggregate_Please_Try_Again_Later")%>");
	   return;
	<%} %>
	var id = document.cform.userid.value;	
	

	var startyear =document.cform.startyears.value;
	var startmonth =document.cform.startmonths.value;
    var endyear =document.cform.endyears.value;
	var endmonth =document.cform.endmonths.value;
	var searchname = document.cform.searchname.value;
	var searchvalue = document.cform.searchvalue.value;
	if(searchvalue=="" || searchvalue==null)searchvalue=-1;
	var categorycode = document.cform.categorycode.value;
	var hospitalgrade = document.cform.hospitalgrade.value;
	var hospitaltype = document.cform.hospitaltype.value;
	var hospitallevel = document.cform.hospitallevel.value;
	var dept3code = document.cform.dept3code.value;
	
	if(Number(startyear) > Number(endyear)){
	  alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	  return;
	}
	else {
	  if(Number(startyear) == Number(endyear)){
	   if(Number(startmonth) > Number(endmonth)){
	      alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	     return;
	   }
	  }
	}
	if(getflag()){
		  var year =document.cform.year.value;
		  var month =document.cform.month.value;
	      if(month == 1){
	    	 endyear = year -1;
	    	 endmonth= 12;
	      }else{
	    	 endmonth = month-1;  
	      }
	}
	var begindate = startyear+"-"+startmonth;
	var enddate = endyear+"-"+endmonth;
	var reportflag=document.cform.reportflag.value;
	var reportname="";
	if(reportflag == 1){
		reportname="HospitalInfoSalesStock";
	}else if(reportflag==3){
		reportname="HospitalInfoSalesStock1";
	}else{
		reportname="HospitalInfoSalesStock2";
	}
	var url;
	<%if("Y".equals(isadmin)){%>
	 var userids =document.cform.userids.value;
	 var areaids = document.cform.areaids.value;
	 url="<%=newreportURL %>/xlsrpt?reportname="+reportname+"&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids;
	<% } else {%>
	<%if(!(new Integer(1).equals(issalesman))){%>

	 var userids =document.cform.userids.value;

	 var areaids = document.cform.areaids.value;
	 url="<%=newreportURL %>/xlsrpt?reportname="+reportname+"&employeeid="+ id+ "&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids;
	<% }else{  %>
		var salesman =document.cform.userid.value;
		url="<%=newreportURL %>/xlsrpt?reportname="+reportname+"&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code;
 	<% }}%>
 	url=url+"&reportflag="+reportflag+"&timestamp="+Date.parse(new Date());
 	DataReport(url);
 }

function page_csv(){
	<%if(!runstatus.equals("END")){ %>
	   alert("<%= message.getMessageDesc("Being_Aggregate_Please_Try_Again_Later")%>");
	   return;
	<%} %>
	var id = document.cform.userid.value;	
	
	
	
	var startyear =document.cform.startyears.value;
	var startmonth =document.cform.startmonths.value;
    var endyear =document.cform.endyears.value;
	var endmonth =document.cform.endmonths.value;
	var searchname = document.cform.searchname.value;
	var searchvalue = document.cform.searchvalue.value;
	if(Number(startyear) > Number(endyear)){
	  alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	  return;
	}
	else {
	  if(Number(startyear) == Number(endyear)){
	   if(Number(startmonth) > Number(endmonth)){
	      alert("<%= message.getMessageDesc("Please_Input_The_Correct_Time")%>");
	     return;
	   }
	  }
	}	
	if(searchvalue=="" || searchvalue==null)searchvalue=-1;
	var categorycode = document.cform.categorycode.value;
	var hospitalgrade = document.cform.hospitalgrade.value;
	var hospitaltype = document.cform.hospitaltype.value;
	var hospitallevel = document.cform.hospitallevel.value;
	var dept3code = document.cform.dept3code.value;
	
	if(getflag()){
		  var year =document.cform.year.value;
		  var month =document.cform.month.value;
	      if(month == 1){
	    	 endyear = year -1;
	    	 endmonth= 12;
	      }else{
	    	 endmonth = month-1;  
	      }
	}
	var begindate = startyear+"-"+startmonth;
	var enddate = endyear+"-"+endmonth;
	
	
	var reportflag=document.cform.reportflag.value;
	var reportname="";
	if(reportflag == 1){
		reportname="HospitalPOSData";
	}else if(reportflag==3){
		reportname="HospitalPOSData1";
	}else{
		reportname="HospitalPOSData2";
	}
	var url;
	<%if("Y".equals(isadmin)){%>
	var userids =document.cform.userids.value;
	var areaids = document.cform.areaids.value;
	url="<%= reportURL %>/csv?__report=/ovalreport/"+reportname+".txt"+"&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids;
    //window.open("<%= reportURL %>/csv?__report=/ovalreport/HospitalPOSData.txt"+"&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids);		

	<% } else {%>
	<%if(!(new Integer(1).equals(issalesman))){%>

	var userids =document.cform.userids.value;
	var areaids =document.cform.areaids.value;
	//var regionid= document.cform.regionid.value;
	url="<%= reportURL %>/csv?__report=/ovalreport/"+reportname+".txt&employeeid="+ id+"&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids;
    //window.open("<%= reportURL %>/csv?__report=/ovalreport/HospitalPOSData.txt&employeeid="+ id+"&userids="+userids+"&begindate="+begindate+"&enddate="+enddate+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code+'&areaids='+areaids);		
	<% }else{  %>
	var salesman =document.cform.userid.value;
	url="<%= reportURL %>/csv?__report=/ovalreport/"+reportname+".txt&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code;
 	//window.open("<%= reportURL %>/csv?__report=/ovalreport/HospitalPOSData.txt&employeeid="+ id+"&begindate="+begindate+"&enddate="+enddate+"&salesman="+salesman+"&searchname=a."+searchname+"&searchvalue="+escape(encodeURI(searchvalue))+"&categorycode="+categorycode+"&hospitalgrade="+hospitalgrade+"&hospitaltype="+hospitaltype+"&hospitallevel="+hospitallevel+"&dept3code="+dept3code);		
 	<% }}%>
 	url=url+"&reportflag="+reportflag;
 	DataReport(url);
 }

function page_clear(){
    cform.categoryid.options[0].selected=true;
    cform.dept3code.options[0].selected=true;
    cform.hospitaltype.options[0].selected=true;
    cform.hospitalgrade.options[0].selected=true;
    cform.hospitallevel.options[0].selected=true; 
	document.cform.areaids.value = "";
	document.cform.businessareaname.value = "";
	cform.userids.value="";
	document.cform.employeename.value="";
	
}
function changecategorycode(){
	var categoryIndex = cform.categoryid.options[cform.categoryid.selectedIndex].value;
	if(categoryIndex =="" || categoryIndex==null)cform.categorycode.value="";
	if(categoryIndex == 4 )cform.categorycode.value = "001";
	if(categoryIndex == 5 )cform.categorycode.value = "002";
	
}

function onLoad1(){
	
	<%
	String strcatid = "";
	if(pageContext.getAttribute("categoryid")=="" || pageContext.getAttribute("categoryid")==null){
		strcatid = "-1";
	}else{
		strcatid = (Integer)pageContext.getAttribute("categoryid")+"";
	}
	System.out.println(strcatid+"11");
	%>
	<%if(strcatid.equals("4")){%>
	cform.categoryid.options[1].selected=true;
	<%}else if(strcatid.equals("5")){%>
	cform.categoryid.options[2].selected=true;
	<%}else{%>
	cform.categoryid.options[0].selected=true;
	<%}%>
	}

function popBusinessarea_moulty(){
	if(popwindow!=null) popwindow.close();
	
    //url = '<%=contextPath %>/zyl/masterdata/map/SelectAreaTree.jsp?<%= OvalTools.randomURL() %>';
    url = '<%=contextPath %>/phap/phap.datp/masterdata/cm/dataclean/ZylStdareaSelect.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=600, width=900,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}
function setAreas(areaids,areanames,areacodes){

	document.cform.areaids.value = areaids;
	document.cform.businessareaname.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 

function  getflag(){
	var year =document.cform.year.value;
	var month =document.cform.month.value;
	var startyear =document.cform.startyears.value;
	var startmonth =document.cform.startmonths.value;
    var endyear =document.cform.endyears.value;
	var endmonth =document.cform.endmonths.value;
	var perioddate = new Date(year+"/"+month+"/1");
	var startdate = new Date(startyear+"/"+startmonth+"/1");
	var enddate = new Date(endyear+"/"+endmonth+"/1");
	if (startdate.getTime() == perioddate.getTime()) {   
		//查询临时表
		document.cform.reportflag.value=1;
	}else if(startdate.getTime() < perioddate.getTime() && enddate.getTime() >= perioddate.getTime()){
		//查询历史+临时表
		document.cform.reportflag.value=2;
		return true;
	}else{
		//查询历史
		document.cform.reportflag.value=3;
	}
	return false;
}
//对Date的扩展，将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符， 
//年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 
//例子： 
//(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 
//(new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18 
Date.prototype.Format = function (fmt) { //author: meizz 
 var o = {
     "M+": this.getMonth() + 1, //月份 
     "d+": this.getDate(), //日 
     "h+": this.getHours(), //小时 
     "m+": this.getMinutes(), //分 
     "s+": this.getSeconds(), //秒 
     "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
     "S": this.getMilliseconds() //毫秒 
 };
 if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 for (var k in o)
 if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
 return fmt;
}
</script>
<style type="text/css">
*{padding:0;margin:0;}
.container {width:230px;margin:1px auto;}
.holder2 {color:#FDFAC5;}
/*wu tu yuan jiao*/
.b1 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; margin:0 5px;background-color:#FDFAC5}
.b2 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:2px solid #FDFAC5; border-left:2px solid #FDFAC5; margin:0 3px;background-color:#FDFAC5}
.b3 {height:1px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 2px;background-color:#FDFAC5}
.b4 {height:2px; font-size:1px; overflow:hidden; display:block; background:#FDFAC5; border-right:1px solid #FDFAC5; border-left:1px solid #FDFAC5; margin:0 1px;background-color:#FDFAC5}
.content {border-right:1px solid #FDFAC5; height:15px;border-left:1px solid #FDFAC5;background-color:#FDFAC5}
</style>
</head>

<body style="overflow: auto;" >
<iframe id="reloadHandler" name="reloadHandler" style="display: none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
<input type="hidden" name="pagename" value="p_zylhospitalbuysalesstockbytime"> 
<input type="hidden" name="actionname"> 
<input type="hidden" name="categorycode" />
<input type="hidden" name="mark" value="1"/>
<input type="hidden" name="oldendyear" />
<input type="hidden" name="oldendmonth" />
<custom:hidden property="reportflag" ></custom:hidden>
<custom:hidden property="year" name="periodmanager"></custom:hidden>
<custom:hidden property="month" name="periodmanager"></custom:hidden>
	<custom:hidden property="userid" name="userinfo" scope="session"></custom:hidden>
	
	 
<%--  page location   --%> <%@ include file="/inc/PageLocation.inc"%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td class="summary_top" width="10%" colspan="3"></td>
			</tr>
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		</td>
	</tr>
	<tr>
		<td>
	 <table width="1200" border="0" cellspacing="0" >
  <tr>
  <%
                  
					/*
					String year = cal.get(Calendar.YEAR)+"";     
				    String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  */
				if("first".equals(flag)){ 
					String year = null;
					String month = null;
					HashMap periodmanager = (HashMap)pageContext.getAttribute("periodmanager");
					if(null == periodmanager){
						year = cal.get(Calendar.YEAR)+"";     
					    month = cal.get(Calendar.MONTH)+"";
					    if(cal.get(Calendar.MONTH) == 0){
							month = "12";
							year = (cal.get(Calendar.YEAR)-1)+"";
						}
					}else{
						year= periodmanager.get("year")+"";
						month=periodmanager.get("month")+"";
					}
				%>
				<%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %>
				<custom:selectdic property="startyears" dictType="Years" command="notnull" label="L_Year1" value="<%=year %>"/>
				<custom:selectdic property="startmonths" dictType="Months" command="notnull" label="L_Month" value="<%=month %>"/> - <custom:selectdic property="endyears" dictType="Years" command="notnull" label="L_Year1" value="<%=year %>"/>
                <custom:selectdic property="endmonths" dictType="Months" command="notnull" label="L_Month" value="<%=month %>"/>
				</td>
				<td class="td_right"><%=label.getLabelName("L_ProdCategory") +  label.getLabelName("L_Colon") %></td>	        	
				<td class="td_left"><custom:selectdic property="categoryid" dictType="PatentOrPopular" value="4,5" defaultValueCost="" defaultValue="-----------" onchange="changecategorycode();"></custom:selectdic></td>
				<td>&nbsp;</td>
				<td width="*"> 
	        	<div class="container">
                   <div class="holder">
                     <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
                       <div class="content">
                           <p>&nbsp;&nbsp;&nbsp;&nbsp;<font size="3"><b><%=label.getLabelName("L_TIP_SPAN") %></b></font>&nbsp;:&nbsp;&nbsp;<%=label.getLabelName("L_TIP_SPAN_VIEW") %>
                           &nbsp;<%=label.getLabelName("L_CLTIME") %>:<custom:write property="cledate" />
				&nbsp;<%=label.getLabelName("L_MBTIME") %>:<custom:write property="backdate" />
				&nbsp;<%=label.getLabelName("L_MCTIME") %>:<custom:write property="coldate" /></p>
                       </div>
                       <b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
                      </div>
                  </div>
	        	</td>
	        	<%}else{ %>
				<%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %>
				<custom:selectdic property="startyears" dictType="Years" command="notnull" label="L_Year1" />
				<custom:selectdic property="startmonths" dictType="Months" command="notnull" label="L_Month" /> - <custom:selectdic property="endyears" dictType="Years" command="notnull" label="L_Year1"/>
                <custom:selectdic property="endmonths" dictType="Months" command="notnull" label="L_Month" />
				</td>
	        	<td class="td_right"><%=label.getLabelName("L_ProdCategory") +  label.getLabelName("L_Colon") %></td>
				<td class="td_left"><custom:selectdic property="categoryid" dictType="PatentOrPopular" value="4,5" defaultValueCost="" defaultValue="-----------" onchange="changecategorycode();"></custom:selectdic></td>
	        	<td>&nbsp;</td>
				<td width="*"> 
	        	<div class="container">
                   <div class="holder">
                     <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
                       <div class="content">
                           <p>&nbsp;&nbsp;&nbsp;&nbsp;<font size="3"><b><%=label.getLabelName("L_TIP_SPAN") %></b></font>&nbsp;:&nbsp;&nbsp;<%=label.getLabelName("L_TIP_SPAN_VIEW") %>
                           &nbsp;<%=label.getLabelName("L_CLTIME") %>:<custom:write property="cledate" />
				&nbsp;<%=label.getLabelName("L_MBTIME") %>:<custom:write property="backdate" />
				&nbsp;<%=label.getLabelName("L_MCTIME") %>:<custom:write property="coldate" /></p>
                       </div>
                       <b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
                      </div>
                  </div>
	        	</td>
	        	    <%
	        	    }
			        %>
                    </tr>
					<tr>
						<td class="td_right"><%=label.getLabelName("L_Hospital") + label.getLabelName("L_FileType") + label.getLabelName("L_Colon") %></td>
						<td class="td_left"><custom:selectdic dictType="HospitalType" property="hospitaltype"   defaultValueCost="" defaultValue="-----------"/></td>
						<td class="td_right"><%= label.getLabelName("L_Hospital") +  label.getLabelName("L_Grade") + label.getLabelName("L_Colon") %></td>                
						<td class="td_left"><custom:selectdic dictType="YLHospitalLevel" property="hospitalgrade" defaultValue="-------------"  defaultValueCost="" /></td>
						<td class="td_right"><%= label.getLabelName("L_Country") + label.getLabelName("L_level") + label.getLabelName("L_Colon") %></td>
						<td class="td_left"><custom:selectdic dictType="HospitalLevel" property="hospitallevel" defaultValue="------------"  defaultValueCost=""/></td>
					    <td class="td_right"><%=label.getLabelName("L_Department") +  label.getLabelName("L_Colon") %></td>
				        <td class="td_left">
					     <custom:select property="dept3code" optionInnerTextKey="deptname" optionsName="alldeptnames" optionValueKey="deptcode" defaultValue="----------" style="width:150px" defaultValueCost="" />
					     </td>
					</tr>
        	     <% 
                   if (new Integer(1).equals(issalesman)){
	             %> 
	                <%}else{ %>
        	   <!--  <tr>
        	    <td  class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
        	  	<td  class="td_left"><custom:select property="regionid" optionInnerTextKey="regionname" style="width:160px" optionsName="resultregion" optionValueKey="regionid" onchange="page_getpriviceoffice()" defaultValue="ALL" defaultValueCost=""/></td>
        	    <td  class="td_right"><%=label.getLabelName("L_Provicetdr") +  label.getLabelName("L_Colon") %></td>
				<td  class="td_left">
					<custom:select property="proviceofficelist" optionInnerTextKey="proviceofficename" optionsName="resultproviceoffice" optionValueKey="proviceofficecode" defaultValue="----------" style="width:150px" defaultValueCost="" onchange="page_getbusinessarea();"/>
		        </td>
			    <td  class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
				<td  class="td_left">
				<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" defaultValue="----------" style="width:180px" defaultValueCost=""/> </td>
        	    <td  class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				-->
				<!--
								<td  class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
			    <td style="width:160px;" class="td_left"> <custom:hidden  property="areaids" />
					<custom:text  property="businessareaname"  label="L_BusinessAreaName" readonly="true"/>
					<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>	
		        </td>
				-->
				 <td  class="td_right"><%=label.getLabelName("L_Provicetdr") +  label.getLabelName("L_Colon") %></td>
			   <td style="width:160px;" class="td_left"> <custom:hidden  property="areaids" />
					             <custom:text  property="businessareaname"  label="L_BusinessAreaName" readonly="true"/>
					             <a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>	
		     </td>
		        
		         <td  class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
		        <td>
			    <custom:text property="employeename" size="20"  style="border:1px #7F9DB9 solid;"/>
				<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
				<custom:hidden property="userids"/>
				<custom:hidden property="employeecode"/>
				</td>
				<td><button type="button" onclick="page_clear()" class="button1" name="re" value="clear" style="width:60"><%=label.getLabelName("L_Clear") %></button></td>
			
			<%} %>
        	</tr>
          </table>
		</td>
	</tr>
	<tr>
	   <td colspan="2">
       <div style="width:100%;height=350;overflow=auto;">
		<table width="180%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
			<tr  class="deepblue-left">
            <td rowspan="2" width="22">&nbsp;</td>
            <td rowspan="2" width="70"><a href="javascript:page_summary('orderby','year')"><%=label.getLabelName("L_YearF")%></a></td>
            <td rowspan="2" width="70"><a href="javascript:page_summary('orderby','month')"><%=label.getLabelName("L_Month")%></a></td>
            <td rowspan="2" width="80"><a href="javascript:page_summary('orderby','orgcode')"><%=label.getLabelName("L_HospitalCode1")%></a></td>
            <td rowspan="2" width="450"><a href="javascript:page_summary('orderby','orgname')"><%=label.getLabelName("L_HospitalName")%></a></td>
            <td rowspan="2" width="90"><a href="javascript:page_summary('orderby','productcode')"><%=label.getLabelName("L_ProdCode")%></a></td>
            <td rowspan="2" width="200"><a href="javascript:page_summary('orderby','productname')"><%=label.getLabelName("L_ProdName")%></a></td>
            <td rowspan="2" width="110"><a href="javascript:page_summary('orderby','initialqty')"><%=label.getLabelName("L_PeriodNumber")%></a></td>
            <td rowspan="2" width="110"><a href="javascript:page_summary('orderby','lxqty')"><%=label.getLabelName("L_FolwQty")%></a></td>
			<td colspan="4"> <center><%=label.getLabelName("L_NotFolwQty")%> </center></td>
			<td rowspan="2" width="110"><a href="javascript:page_summary('orderby','totalqty')"></a>商销量(购进)</td>
            <td rowspan="2" width="110"><a href="javascript:page_summary('orderby','totalamount')">购进合计(元)</a></td>
            <td rowspan="2" width="90"><a href="javascript:page_summary('orderby','salesqty')">纯销量(销售)</a></td>
            <td rowspan="2" width="90"><a href="javascript:page_summary('orderby','salesamount')">销售数量(元)</a></td> 
            <td rowspan="2" width="110"><a href="javascript:page_summary('orderby','stockqty')"><%=label.getLabelName("L_UPNUmber")%></a></td>
			<td rowspan="2" width="110"><a href="javascript:page_summary('orderby','endqty')"><%=label.getLabelName("L_EntQty")%></a></td>
            <td rowspan="2" width="180"><a href="javascript:page_summary('orderby','area2name')"><%=label.getLabelName("L_Provicetdr")%></a></td>
            <td rowspan="2" width="200"><a href="javascript:page_summary('orderby','area1name')"><%=label.getLabelName("L_RegionOffice")%></a></td>
            <td rowspan="2" width="170"><a href="javascript:page_summary('orderby','salesrepname')"></a>代表名称</td>
            <td rowspan="2" width="130"><a href="javascript:page_summary('orderby','parentsalesrepname')"><%=label.getLabelName("L_ManegerNameMN")%></a></td>
            <td rowspan="2" width="150"><a href="javascript:page_summary('orderby','productgroupname')"><%=label.getLabelName("L_ProductGroupName")%></a></td>

              
                 <!-- 
                 <td rowspan="2" width="150"><%=label.getLabelName("L_ProdAttribute")%></td>
                  -->
                
                <%if(!ruleday.equals("Y")){ %>
                 <td rowspan="2" width="150"><%=label.getLabelName("L_Remarks")%></td>
               <%} %>
                </tr>
                <tr height="30"  class="deepblue-left">
                 <td width="90"><%=label.getLabelName("L_CHuanGoods")%></td>
                 <td width="110"><%=label.getLabelName("L_QTQTY")%></td> 
                 <td width="90"><%=label.getLabelName("L_FANLiuXiang")%></td>
                 <td width="140"><%=label.getLabelName("L_NotFolwQtySum")%></td>
                </tr>

			<tbody>
				<%
	            Integer nDefaultId = new Integer(-1);
	            int i=0;
	            String strChecked = "";
	            String strClassType = "none";
	            boolean bHasChecked = false;
	          %>
				<logic:iterate id="onerow" collection="<%= summary %>">
				
				
					<%
					HashMap onerowMap = (HashMap)pageContext.getAttribute("onerow"); 
	            if(i%2 == 1){
	              strClassType = "td-listrom";
	            }else{
	              strClassType = "none";
	            }
	            String remarks = (String)((HashMap)pageContext.getAttribute("onerow")).get("remarks");
	            if(!bHasChecked){
	              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("onerow")).get("orgposdataid");
	              bHasChecked = true;
	              strChecked = "Checked";
	            }else{
	              strChecked = "";
	            }
	            i++;
	          %>
				
				 	<tr  onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%= strClassType %>'"  onClick="javascript:radiotrue('radio<%=i%>');clickRow(this,<%=i%>);"  class="<%= strClassType%>">  		
						
	          <td  class="<%=JspHelper.filterNull( strClassType )%>">
            	<input type="radio" id="radio<%=JspHelper.filterNull( i )%>" name="orgposdataid"  value=<%=JspHelper.filterNull( onerowMap.get("orgposdataid") )%> class="checkbox" <%=JspHelper.filterNull( strChecked )%>>
            </td>
	           
							<td><custom:write name="onerow" property="year"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="month" nbsp="true" /></td>
							<td><custom:write name="onerow" property="orgcode"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="orgname" nbsp="true" /></td>
							<td><custom:write name="onerow" property="productcode"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="productname" nbsp="true" /></td>
							<td><custom:write name="onerow" property="initialqty"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="lxqty"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="chqty" nbsp="true" /></td>
							<td><custom:write name="onerow" property="qtqty" nbsp="true" /></td>
							
							<td><custom:write name="onerow" property="flxqty"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="notflowqty"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="totalqty" nbsp="true" /></td>
							<td><custom:write name="onerow" property="totalamount"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="salesqty" nbsp="true" /></td>
							<td><custom:write name="onerow" property="salesamount"	nbsp="true" /></td>							
							<td><custom:write name="onerow" property="stockqty" nbsp="true" /></td>
							<td><custom:write name="onerow" property="endqty" nbsp="true" /></td>
							<td><custom:write name="onerow" property="area2name" nbsp="true" /></td>
							<td><custom:write name="onerow" property="area1name"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="salesrepname" nbsp="true" /></td>
							<td><custom:write name="onerow" property="parentsalesrepname"	nbsp="true" /></td>
							<td><custom:write name="onerow" property="productgroupname" nbsp="true" /></td>

				<!-- 
						<td><custom:write name="onerow" property="attribute" nbsp="true" /></td>
						 -->
							<%
	 					if(i==1){
	 						%>
	 					<custom:hidden property="orgid" name="onerow" changedName="temporgid"/> 
	 					<custom:hidden property="productid" name="onerow" changedName="tempproductid"/> 
	 					<custom:hidden property="month" name="onerow" changedName="tempmonth"/> 
	 					<custom:hidden property="year" name="onerow" changedName="tempyear"/> 
	 					<% 
	 					}
							if(!ruleday.equals("Y")){
								if("Y".equals(issalesman)){
	 					%>
						
						<%if(remarks==null || remarks==""){ %>
						<td onclick="showDiv('submit')"><%= label.getLabelName("L_Add") + label.getLabelName("L_Remarks")%></td>
						<%}else{ %>
						<td onclick="showDiv('submit')"> <%= label.getLabelName("L_View") + label.getLabelName("L_Remarks")%> </td>
						<%}  }else{
						    	 %>
						    	 <td onclick="showDiv('submit')"> <%= label.getLabelName("L_View") + label.getLabelName("L_Remarks")%>  </td>
						 <%    } }%>
						 <%
	            String str1 = "orgposdataid"+JspHelper.filterNull(i);
	            String str2 = "remarks"+JspHelper.filterNull(i);
	            String str3 = "orgid"+JspHelper.filterNull(i);
	            String str4 = "productid"+JspHelper.filterNull(i);
	            String str5 = "month"+JspHelper.filterNull(i);
	            String str6 = "year"+JspHelper.filterNull(i);
	            %> 
	            
	               <custom:hidden name="onerow" property="orgposdataid" changedName="<%=str1 %>" />
	             <custom:hidden name="onerow" property="remarks" changedName="<%=str2 %>" /> 
	             <custom:hidden name="onerow" property="orgid" changedName="<%=str3 %>" /> 
	             <custom:hidden name="onerow" property="productid" changedName="<%=str4 %>" /> 
	             <custom:hidden name="onerow" property="month" changedName="<%=str5 %>" /> 
	             <custom:hidden name="onerow" property="year" changedName="<%=str6 %>" /> 
	         
					</tr>
				</logic:iterate>
			</tbody>
			<tfoot>
            <tr> 
	          <td colspan="7" style="text-align:right"><%=label.getLabelName("L_PageSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red"><b><custom:write name="sumhash" property="suminitialqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumlxqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumchqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumqtqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumflxqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="notflowsumqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumamount" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumsalesqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumsalesamount" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="sumstockqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="endsumqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat"/></b></td>
				<td colspan="7">&nbsp;</td>
	        </tr>
	        <tr> 
	            <td colspan="7" style="text-align:right"><%=label.getLabelName("L_TotalSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisuminitialqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumlxqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumchqty"   dataType="number" dataFormatName="qtyviewformat" nbsp="true"/></b></td>
			    <td class="red"><b><custom:write name="sumhash" property="hospisumqtqty"   dataType="number" dataFormatName="qtyviewformat" nbsp="true"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumflxqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash" property="notflowsumqtyall"   dataType="number" dataFormatName="qtyviewformat" nbsp="true"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumtotalqty"   dataType="number" dataFormatName="qtyviewformat" nbsp="true"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumtotalamount"   dataType="number" dataFormatName="amountviewformat" nbsp="true"/></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumsalesqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
				<td class="red"><b><custom:write name="sumhash" property="hospisumsalesamount"   dataType="number" dataFormatName="amountviewformat" nbsp="true"/></b></td>
	         	<td class="red"><b><custom:write name="sumhash" property="hospisumstockqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
			    <td class="red"><b><custom:write name="sumhash" property="sumallendqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
					<td colspan="7"><%@ include file="/inc/SummaryAction.inc"%>
					</td>
				</tr>
			</tfoot>
		</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center">
				<a onclick="page_excel();"><custom:button type="1" label="L_ALL_BIG_Execcd" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="MB-YYJXC01"/></a>&nbsp;&nbsp;
				<a onclick="page_csv();"><custom:button type="1" label="L_ExportCSV" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="MB-YYJXC02"/></a>&nbsp;&nbsp;
				<%if(pageContext.getAttribute("totalsummary")!=null){%>
               
                <a onclick="page_InBuyDetail();"><custom:button type="1" label="L_CheckInBuyDetail" imgsrc="Modify.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
               
                <a onclick="page_OutBuyDetail();"><custom:button type="1" label="L_CheckOutBuyDetail" imgsrc="delete.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
            <a onclick="page_StockDetail();"><custom:button type="1" label="L_InfoBuyStockDetail" imgsrc="delete.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
            <%} %>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>

<!-- Large Text Input Window -->
<div id="submit" class="deepblue-left"
	style="width: 400px; height: 125px; border: 5px #999999 double; position: absolute; display: none">
<div id="close" class="deepblue-left"
	style="width: 400px; height: 25px; text-align: right; cursor: move;"><img
	src="../../images/closeXXX.jpg" style="cursor: hand"
	onclick="hidDiv('submit')"></div>
<div style="text-algin: center; height: 100px;">
<table cellspacing="0" cellpadding="0">
	<tr>
		<td height="100px">
		<table border="1" width="395px" height="100px" cellspacing="0"
			cellpadding="0" align="center">
			<tr>
				<td align="right"><%= label.getLabelName("L_NoteThat") + label.getLabelName("L_Colon") %></td>
				<td><custom:textarea property="re_mark" cols="40" rows="3" />
				<custom:hidden property="orgposdata_id" /></td>
			</tr>
			<tr>
			 <% if(new Integer(1).equals(issalesman)){ %>
				<td class="td_center" colspan="2">
				<input type="button" name="subbutton" value="<%=label.getLabelName("L_Confirm")%>" onclick="subDiv()" /> 
				<custom:button label="L_Cancel" onclick="hidDiv('submit')"></custom:button></td>
					<%}else{ %>
						<td class="td_center" colspan="2">
						 <custom:button label="L_Cancel" onclick="hidDiv('submit')"></custom:button></td>
					<%} %>
			</tr>
		</table>
		</td>
	</tr>
</table>
</div>
</div>
</form>
<iframe name="reloadHandler" style="display: none"></iframe>
<script type="text/javascript">
window.onload = function() {
    var newMask = document.createElement("div");
    newMask.id = "mDiv";
    newMask.style.position = "absolute";
    newMask.style.zIndex = "5000";
    _scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    newMask.style.width = "2100";
    newMask.style.height = "100%";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#33393C";
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
    newMask.style.display = 'none';
    newMask.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
    document.body.appendChild(newMask);
    document.getElementById("submit").style.zIndex = "5002";
    var objDrag = document.getElementById("close");
    var drag = false;
    var dragX = 0;
    var dragY = 0;
    objDrag.attachEvent("onmousedown", startDrag);
    function startDrag() {
        if (event.button == 1 && event.srcElement.tagName.toUpperCase() == "DIV") {
            event.srcElement.setCapture();
            event.srcElement.style.background = "#ECECEC";
            drag = true;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmousemove", Drag);
    function Drag() {
        if (drag) {
            var oldwin = event.srcElement.parentNode;
            oldwin.style.left = oldwin.offsetLeft + event.clientX - dragX;
            oldwin.style.top = oldwin.offsetTop + event.clientY - dragY;
            oldwin.style.left = event.clientX - 100;
            oldwin.style.top = event.clientY - 10;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmouseup", stopDrag);
    function stopDrag() {
        event.srcElement.style.background = "#90AAC5";
        event.srcElement.releaseCapture();
        drag = false;
    };
}
onLoad1();
changecategorycode();
</script>
</body>
</html>
